Namespacing everything to /UVa.
[andmenj-acm.git] / UVa / 543 - Goldbach's conjecture / 506.cpp
blob03c1837419d4915a2db34a1511ea159ac4232de1
1 using namespace std;
2 #include <algorithm>
3 #include <iostream>
4 #include <iterator>
5 #include <sstream>
6 #include <fstream>
7 #include <cassert>
8 #include <climits>
9 #include <cstdlib>
10 #include <cstring>
11 #include <string>
12 #include <cstdio>
13 #include <vector>
14 #include <cmath>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <list>
19 #include <map>
20 #include <set>
22 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); x != (v).end(); ++x)
23 #define For(i, a, b) for (int i=(a); i<(b); ++i)
24 #define D(x) cout << #x " is " << x << endl
26 const int MAXN = 1000005;
27 bool prime[MAXN];
29 int main(){
30 memset(prime, true, sizeof prime);
31 prime[0] = prime[1] = false;
32 for (int i=4; i<MAXN; i += 2) prime[i] = false;
33 for (int i=3; i<MAXN; i += 2){
34 if (prime[i]){
35 for (int j=i+i; j<MAXN; j += i) prime[j] = false;
39 int n;
40 while (scanf("%d", &n)==1 && n){
41 int m = n / 2;
42 for (int a = 3; a <= m; a += 2){
43 if (prime[a] && prime[n-a]){
44 printf("%d = %d + %d\n", n, a, n-a);
45 break;
49 return 0;